package cn.lhq.controller.user;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.lhq.bean.User;
import cn.lhq.service.UserServiceImpl;

@Controller
@RequestMapping("/user")
public class FindByNameController {
	@Resource
	UserServiceImpl userServiceImpl;
	@RequestMapping("/findByName.do")
	@ResponseBody
	public User findByName(String username){
		System.out.println("--controller");
		User user = null;
		try {
			user = userServiceImpl.findByName(username);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("-----controller---"+user.getUsername());
		return user;
	}
}
